<template>
  <div>
    <el-form ref="querForm" size="mini" inline="true" model="querForm">
      <el-form-item label="订单id">
        <el-input
          v-model="querForm.orderid"
          placeholder="请输入查询的订单id"
        ></el-input>
      </el-form-item>

      <el-form-item label="">
        <el-button type="primary" @click="chaxun">查询</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="tableData" style="width: 100%">
      <el-table-column prop="id" label="id"  width="100"> </el-table-column>
      <!-- <el-table-column prop="openid" label="用户openid"> </el-table-column> -->
      <el-table-column prop="orderid" label="订单编号" width="180"> </el-table-column>
      <el-table-column prop="booktime" label="预约上门时间"  width="180"> </el-table-column>
      <el-table-column prop="status" label="订单状态"  width="80" align="center"> </el-table-column>
      <el-table-column prop="ordertime" label="用户下单时间"  width="180"> </el-table-column>

      <el-table-column prop="servicename" label="维修项目"> </el-table-column>
      <el-table-column prop="serviceaddress" label="服务地址" width="170">
      </el-table-column>
      <el-table-column prop="telnumber" label="用户联系电话"> </el-table-column>
      <el-table-column prop="employeeid" label="接单员工"> </el-table-column>

      <el-table-column prop="actualpayment" label="用户实付金额">
      </el-table-column>
      <el-table-column prop="chargedetail" label="费用详情"> </el-table-column>

      <el-table-column prop="ispayment" label="支付状态"> </el-table-column>
    </el-table>

    <el-pagination
      class="el-pagination"
      background
      layout="prev, pager, next"
      @current-change="changePage"
      :page-size="querForm.pagesize"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
import { getorderlistlength, list, cx } from "@/api/orderlist";

export default {
  name: "list-index",
  data() {
    return {
      query: "",
      tableData: [],
      open: false,
      form: {},
      title: "",

      querForm: {
        page: 1,
        pagesize: 7,
        orderid: "",
      },
      total: 50,
      loading: true,
    };
  },

  created() {
     this.loadData();
  },
  methods: {
    loadData() {
      setTimeout(() => {
        this.loading = false;
      }, 400);
      list(this.querForm).then((resp) => {
        this.tableData = resp;
      });

      this.getorderlistlength();
    },

    //获取总数据条数
    getorderlistlength() {
      getorderlistlength().then((resp) => {
        this.total = resp;
      });
    },

    //查询

    chaxun() {
      this.querForm.page = 1;
      cx(this.querForm).then((resp) => {
        this.tableData = resp;
      });
    },

    changePage(page) {
      this.querForm.page = page;
      this.loadData();
    },
  },
};
</script>

<style scoped>
.el-pagination {
  position: absolute;
  top: 850px;
}
</style>